<template>
    <div class="white-box">
        <div class="table-mb">
            <el-button type="primary" @click="clickAdd">添加供应商</el-button>
        </div>

        <div class="task-one">
            <div class="task-one__item">
                <span class="task-one__label">供应商名称：</span>
                <el-input placeholder="输入供应商名称" v-model.trim="supplier_name" clearable></el-input>
            </div>
            <div class="task-one__item">
                <span class="task-one__label">供应商ID：</span>
                <el-input placeholder="输入供应商ID" v-model.trim="supplier_id" clearable></el-input>
            </div>
            <div class="task-one__item">
                <span class="task-one__label">手机号：</span>
                <el-input v-model.trim="tel" maxlength="11" clearable placeholder="输入手机号" oninput="value=value.replace(/[^\d-]/g,'')"> </el-input>
            </div>
             <div class="task-one__item">
                <span class="task-one__label">站点名称：</span>
                <el-input placeholder="输入站点名称" v-model.trim="dc_title" clearable></el-input>
            </div>
            <div class="task-one__item">
                <span class="task-one__label">供应商标签：</span>
                <el-select v-model="tag_ids" clearable placeholder="请选择供应商标签">
                    <el-option :label="item.title" :value="item.tag_id" v-for="item in tag_list" :key="item.tag_id" />
                </el-select>
            </div>
            <div class="task-one__item">
                <span class="task-one__label">供应商状态：</span>
                <el-select v-model="supplier_type" clearable placeholder="请选择供应商状态">
                    <el-option label="已停用" value="1" />
                    <el-option label="已启用" value="2" />
                </el-select>
            </div>
            <div class="task-one__item">
                <span class="task-one__label">保证金状态：</span>
                <el-select v-model="danbao_status" clearable placeholder="请选择保证金状态">
                    <el-option label="关闭" value="1" />
                    <el-option label="开启" value="2" />
                </el-select>
            </div>
            <div class="task-one__item">
                <span class="task-one__label word-space">创建时间：</span>
                <el-date-picker
                    v-model="area_time"
                    type="daterange"
                    unlink-panels
                    value-format="YYYY-MM-DD"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                />
            </div>
            <div class="task-one__btn task-wrap-btn clearfix" style="padding-left: 84px">
                <el-button type="primary" :loading="search_btn" :icon="Search" @click="handleSearch">搜索</el-button>
                <el-button @click="clickExport">导出</el-button>
            </div>
        </div>

        <el-table
            class="table-mb"
            v-loading="loading"
            :data="arr_data"
            :header-cell-style="{ background: '#F5F7FA' }"
            element-loading-background="rgba(255, 255, 255, 0.6)"
        >
            <el-table-column label="供应商名称" width="220" fixed="left">
                <template #default="{ row }">
                    <div class="table-lr">
                        <el-image class="table-lr__img img-small" loading="lazy" :src="proxy.imgUrl + row.logo" fit="cover" v-if="row.logo" />
                        <div class="table-lr__right small-right" :style="{ marginLeft: row.logo ? '10px' : '0' }">
                            <p class="lr-title">{{ row.title }}</p>
                            <p>ID：{{ row.supplier_id }}</p>
                        </div>
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="tag_value" label="标签" min-width="160"></el-table-column>
            <el-table-column prop="dc_title" label="站点名称" min-width="120"></el-table-column>
            <el-table-column label="商品" min-width="150">
                <template #default="{ row }">
                    <p>上架商品数：{{ row.product_count || 0 }}</p>
                    <p>商品库数：{{ row.product_sku || 0 }}</p>
                </template>
            </el-table-column>
            <el-table-column label="销量" min-width="140">
                <template #default="{ row }">
                    <p>订单数量：{{ row.orders || 0 }}</p>
                    <p>总收益：{{ row.total_money || 0 }}</p>
                </template>
            </el-table-column>
            <el-table-column label="财务" min-width="160">
                <template #default="{ row }">
                    <p>已提现：{{ row.tixian_money || 0 }}</p>
                    <p>余额：{{ row.money || 0 }}</p>
                    <p>佣金百分比：{{ row.award_percent || 0 }}%</p>
                </template>
            </el-table-column>
            <el-table-column label="排序" width="120">
                <template #default="{ row }">
                    <el-input
                        v-model.trim="row.order_by"
                        clearable
                        placeholder="请输入排序数字"
                        oninput="value=value.replace(/[^\d]/g,'')"
                        style="width: 90px"
                        @change="() => inputSort(row)"
                    />
                </template>
            </el-table-column>
            <el-table-column label="保证金" width="174">
                <template #default="{ row }">
                    <p>保证金：{{ row.danbao || "0" }}</p>
                    <p>最低保证金：{{ row.min_danbao || "0" }}</p>
                    <p>
                        保证金状态： <span style="color: #4b93fa">{{ row.danbao_status == 1 ? "开启" : "关闭" }}</span>
                    </p>
                </template>
            </el-table-column>
            <el-table-column label="状态" width="80">
                <template #default="{ row }">
                    <span style="color: #4b93fa">{{ row.supplier_status == 1 ? "已启用" : "已停用" }}</span>
                </template>
            </el-table-column>
            <el-table-column label="操作" width="246" class-name="operation-nav" fixed="right">
                <template #default="{ row }">
                    <el-popconfirm
                        :title="`是否确定${row.supplier_status == 1 ? '停用' : '启用'}？`"
                        confirm-button-text="确定"
                        cancel-button-text="取消"
                        @confirm="clickSwitch(row)"
                    >
                        <template #reference>
                            <el-button link type="primary" class="theme-btn"> {{ row.supplier_status == 1 ? "停用" : "启用" }}</el-button>
                        </template>
                    </el-popconfirm>
                    <el-button link type="primary" class="theme-btn" @click="clickEdit(row)">编辑</el-button>
                    <el-popconfirm title="是否确定删除？" confirm-button-text="确定" cancel-button-text="取消" @confirm="clickDel(row)">
                        <template #reference>
                            <el-button link type="primary" class="theme-btn">删除</el-button>
                        </template>
                    </el-popconfirm>
                    <el-button link type="primary" class="theme-btn" @click="changeMoney(row)">调整余额</el-button>
                    <el-button link type="primary" class="theme-btn" @click="clickSetBond(row)">设置保证金</el-button>
                    <el-button link type="primary" class="theme-btn" @click="adjustBond(row)">调整保证金</el-button>
                    <el-button link type="primary" class="theme-btn" @click="clickGrant(row)">授权商品</el-button>
                    <el-button link type="primary" class="theme-btn" @click="clickFinance(row)">财务报表</el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- 分页 -->
        <el-pagination
            background
            v-model:current-page="page"
            v-model:page-size="pageSize"
            :page-sizes="pageSizeNum"
            :total="totalNums"
            layout="total, sizes, prev, pager, next, jumper"
        >
        </el-pagination>

        <!-- 调整余额 -->
        <el-dialog v-model="dialogMoney" title="调整余额" width="640px" :append-to-body="true" :destroy-on-close="true" @close="closeMoney">
            <el-form ref="ruleRef" :model="ruleForm" :rules="ruleCheck" label-width="120px">
                <el-form-item label="供应商名称">
                    <p>{{ ruleForm.title }}</p>
                </el-form-item>
                <el-form-item label="当前余额">
                    <p>{{ ruleForm.balances }}</p>
                </el-form-item>
                <el-form-item label="调整类型" required>
                    <el-radio-group v-model="ruleForm.money_type">
                        <el-radio label="1">增加</el-radio>
                        <el-radio label="2">减少</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="调整余额" prop="price">
                    <el-input v-model.trim="ruleForm.price" oninput="value=value.replace(/[^\d.]/g,'')" clearable placeholder="请输入调整余额" />
                </el-form-item>
                <el-form-item label="调整备注" prop="reason">
                    <el-input v-model.trim="ruleForm.reason" type="textarea" clearable :rows="4" placeholder="请输入备注内容，例：线下收款，后台充值" />
                </el-form-item>
                <el-form-item>
                    <div class="flexs" style="margin-top: 30px">
                        <el-button type="primary" :loading="form_loading" @click="submitForm(ruleRef)"> 确认调整 </el-button>
                        <el-button @click="resetForm(ruleRef)">重置</el-button>
                    </div>
                </el-form-item>
            </el-form>
        </el-dialog>

        <!-- 设置保证金 -->
        <el-dialog v-model="dialogSetBond" title="设置保证金" width="600px" :append-to-body="true" :destroy-on-close="true" @close="closeSetBond">
            <detail-item bottom="16px" title="供应商名称" :value="itemObjs.title" />
            <detail-item class="detail-line" title="保证金状态">
                <el-switch
                    v-model="setBondstatus"
                    inline-prompt
                    width="72px"
                    size="large"
                    active-text="开启"
                    inactive-text="关闭"
                    :active-value="1"
                    :inactive-value="0"
                />
            </detail-item>
            <detail-item class="detail-line" title="最低保证金">
                <el-input v-model.trim="min_danbao" oninput="value=value.replace(/[^\d.]/g,'')" clearable placeholder="请输入最低保证金" style="width: 300px" />
            </detail-item>
            <template #footer>
                <span class="dialog-footer">
                    <el-button type="primary" :loading="form_loading" @click="confirmSetBond">确认</el-button>
                    <el-button @click="dialogSetBond = false">取消</el-button>
                </span>
            </template>
        </el-dialog>

        <!-- 调整保证金 -->
        <el-dialog v-model="dialogBond" title="调整保证金" width="640px" top="9vh" :append-to-body="true" :destroy-on-close="true" @close="closeBond">
            <el-form ref="ruleTwoRef" :model="ruleTwoForm" :rules="ruleTwoCheck" label-width="120px">
                <el-form-item label="供应商名称">
                    <p>{{ ruleTwoForm.title }}</p>
                </el-form-item>
                <el-form-item label="当前保证金">
                    <p>{{ ruleTwoForm.danbao }}</p>
                </el-form-item>
                <el-form-item label="调整类型">
                    <el-radio-group v-model="ruleTwoForm.bond_type">
                        <el-radio label="1">增加</el-radio>
                        <el-radio label="2">减少</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="资金来源" v-show="ruleTwoForm.bond_type == 1">
                    <el-radio-group v-model="ruleTwoForm.from_price">
                        <el-radio label="offline">线下</el-radio>
                        <el-radio label="money">余额</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="调整保证金" prop="price">
                    <el-input v-model.trim="ruleTwoForm.price" oninput="value=value.replace(/[^\d.]/g,'')" clearable placeholder="请输入保证金金额" />
                </el-form-item>
                <el-form-item label="调整备注" prop="reason">
                    <el-input v-model.trim="ruleTwoForm.reason" type="textarea" clearable :rows="4" placeholder="请输入备注内容，例：线下收款，后台充值" />
                </el-form-item>
                <el-form-item label="上传凭证">
                    <div class="img-list" v-if="ruleTwoForm.voucherImgs.length > 0" style="flex: none">
                        <div class="img-selects" v-for="(item, index) in ruleTwoForm.voucherImgs" :key="index">
                            <el-image
                                class="img-selects__pic"
                                :src="proxy.imgUrl + item + '!img_400'"
                                :preview-src-list="voucherList"
                                :initial-index="index"
                                fit="cover"
                            />
                            <div class="img-del" @click.stop="delImg(index)">
                                <el-icon size="14px" color="#fff"><CloseBold /></el-icon>
                            </div>
                        </div>
                    </div>
                    <div class="img-box flexs-center" @click.stop="clickVoucher" v-if="ruleTwoForm.voucherImgs.length < 3">
                        <el-icon color="#999" size="26px">
                            <UploadFilled />
                        </el-icon>
                    </div>
                    <p class="input-tips">可选择<code>1~3张</code>图片</p>
                </el-form-item>
                <el-form-item>
                    <div class="flexs" style="margin-top: 30px">
                        <el-button type="primary" :loading="form_loading" @click="submitTwoForm(ruleTwoRef)"> 确认调整 </el-button>
                        <el-button @click="resetTwoForm(ruleTwoRef)">重置</el-button>
                    </div>
                </el-form-item>
            </el-form>
        </el-dialog>
    </div>

    <!-- 图片库 -->
    <picture-library :show="showImg" :select_multiple="true" @close="showImg = false" @select="selectImg"> </picture-library>

    <go-back />
</template>

<script setup>
import { getCurrentInstance, ref, onMounted, watch, reactive, onBeforeUnmount, onActivated } from "vue"
import { useRouter, onBeforeRouteLeave } from "vue-router"
import { useBaseStore } from "@store/base"
import OneLoad from "@mixins/one-load"
import { Search, UploadFilled, CloseBold } from "@element-plus/icons-vue"
import GoBack from "@components/GoBack.vue"
import DetailItem from "@components/DetailItem.vue"
import PictureLibrary from "@components/PictureLibrary.vue"

const store = useBaseStore()
const router = useRouter()
const { proxy } = getCurrentInstance()

onMounted(() => {
    getPublickSearch()
    getList()
})

onBeforeUnmount(() => {
    ruleTwoRef.value = null
    ruleRef.value = null
})

onActivated(() => {
    arr_data.value = []
    getList()
})

// 离开-可以利用这个触发删除页面缓存操作
onBeforeRouteLeave((to, from, next) => {
    if (to.name === "SupplierListEdit") {
        store.setInclude("SupplierList")
    } else {
        store.delInclude("SupplierList")
    }
    next()
})

/**
 * minxin列表加载
 */
const { page, pageSizeNum, pageSize, loading, arr_data, totalNums, search_btn, pubParams, pubRefreshParams, getdata } = OneLoad()
// 切换每页显示条数
watch(pageSize, (val) => {
    page.value = 1
    pubParams(getList)
})
// 跳转第几页
watch(page, (val) => {
    pubParams(getList)
})

function getList() {
    let params = {
        page: page.value,
        limit: pageSize.value,
        supplier_id: supplier_id.value,
        so: supplier_name.value,
        mobile: tel.value,
        tag_id: tag_ids.value,
        dc_title: dc_title.value,
        danbao_status: danbao_status.value,
        supplier_status: supplier_type.value,
        s_time: area_time.value ? area_time.value[0] : "", // 创建时间
        l_time: area_time.value ? area_time.value[1] : "",
    }
    getdata("supplier/index", params)
}

/**
 * 搜索
 * @param {String} supplier_id 供应商ID
 * @param {String} tag_ids 选中的标签ID
 * @param {String} dc_title 站点名称
 * @param {String} supplier_type 供应商状态,1是已停用，2是已启用
 * @param {String} danbao_status 保证金状态,1是已关闭，2是开启
 * @param {String} area_time 创建时间
 */
const supplier_id = ref("")
const dc_title = ref("")
const supplier_name = ref("")
const tel = ref("")
const area_time = ref("")
const supplier_type = ref("")
const tag_ids = ref("")
const danbao_status = ref("")
const handleSearch = () => {
    search_btn.value = true
    pubRefreshParams(getList)
}

/***
 * 获取标签和站点数据
 * @param {Array} tag_list 标签数据
 * @param {Array} dc_list 站点数据
 */
const tag_list = ref([])
const dc_list = ref([])
function getPublickSearch() {
    proxy.$axios
        .get("supplier/search")
        .then((res) => {
            if (res.data.code == 0) {
                let result = res.data.data
                tag_list.value = result.tag_list
                dc_list.value = result.dc_list
            } else {
                proxy.$message({ message: res.data.msg, type: "error" })
            }
        })
        .catch((err) => {})
}

// 启用/停用
const clickSwitch = (row) => {
    proxy.$axios
        .post("supplier/status", {
            supplier_id: row.supplier_id,
            status: row.supplier_status == 0 ? 1 : 0,
        })
        .then((res) => {
            if (res.data.code == 0) {
                pubParams(getList)
            } else {
                proxy.$message({ message: res.data.msg, type: "error" })
            }
        })
        .catch((err) => {})
}

// 删除单个
const clickDel = (row) => {
    postDel(row.supplier_id)
}
// 删除接口
function postDel(params) {
    proxy.$axios
        .post("supplier/delete", {
            supplier_id: params,
        })
        .then((res) => {
            if (res.data.code == 0) {
                pubParams(getList)
            } else {
                proxy.$message({ message: res.data.msg, type: "error" })
            }
        })
        .catch((err) => {})
}

// 排序
const inputSort = (row) => {
    if (!row.order_by) {
        proxy.$message({ message: "请输入排序数字", type: "warning" })
        return
    }
    proxy.$axios
        .post("supplier/sort", {
            supplier_id: row.supplier_id,
            order_by: row.order_by,
        })
        .then((res) => {
            if (res.data.code == 0) {
                pubParams(getList)
            } else {
                proxy.$message({ message: res.data.msg, type: "error" })
            }
        })
        .catch((err) => {})
}

/**
 * 调整余额
 * @param {Boolean} dialogMoney 弹窗状态
 * @param {Boolean} form_loading 弹窗按钮状态
 * @param {Object} money_obj 余额token
 * @param {Array} ruleRef 表单规则
 * @param {Object} ruleForm  表单字段
 * @param {Object} ruleCheck  表单提示
 */
const dialogMoney = ref(false)
const form_loading = ref(false)
const money_token = ref("")
const ruleRef = ref(null)
const ruleForm = reactive({
    id: "",
    title: "",
    balances: "",
    price: "",
    reason: "",
    money_type: "1",
})
const ruleCheck = reactive({
    price: [{ required: true, validator: proxy.$util.validNumOrPoint, trigger: "blur" }],
    reason: [{ required: true, message: "请输入备注内容", trigger: "blur" }],
})
// 确认调整余额
const submitForm = (formEl) => {
    if (!formEl) return
    formEl.validate((valid, fields) => {
        if (valid) {
            form_loading.value = true
            let data = {
                supplier_id: ruleForm.id,
                type: ruleForm.money_type,
                money: ruleForm.price,
                intro: ruleForm.reason,
                money_token: money_token.value,
            }
            proxy.$axios
                .post("supplier/money", data)
                .then((res) => {
                    form_loading.value = false
                    if (res.data.code == 0) {
                        dialogMoney.value = false
                        proxy.$message({ message: "调整余额成功！", type: "success" })
                        pubParams(getList)
                    } else {
                        proxy.$message({ message: res.data.msg, type: "error" })
                    }
                })
                .catch((err) => {
                    form_loading.value = false
                })
        }
    })
}
const resetForm = (formEl) => {
    if (!formEl) return
    formEl.resetFields()
}
const closeMoney = () => {
    resetForm(ruleRef.value)
    dialogMoney.value = false
    form_loading.value = false
}
// 点击调整余额
const changeMoney = (row) => {
    dialogMoney.value = true
    getMoney(row.supplier_id)
    setTimeout(() => {
        ruleForm.id = row.supplier_id
        ruleForm.title = row.title
        ruleForm.balances = row.money
    }, 50)
}
function getMoney(sid) {
    proxy.$axios
        .get("supplier/money", {
            params: {
                supplier_id: sid,
            },
        })
        .then((res) => {
            if (res.data.code == 0) {
                money_token.value = res.data.money_token
            } else {
                proxy.$message({ message: res.data.msg, type: "error" })
            }
        })
        .catch((err) => {})
}

const itemObjs = ref({})

/**
 * 设置保证金
 * @param {Boolean} dialogSetBond 弹窗状态
 * @param {Number} setBondstatus 保证金状态，0是关闭，1开启
 */
const dialogSetBond = ref(false)
const setBondstatus = ref(0)
const min_danbao = ref("")
const confirmSetBond = proxy.$util.throttle(() => {
    let regu = /^\d+(\.\d{1,2})?$/
    if (!min_danbao.value || !regu.test(min_danbao.value)) {
        proxy.$message({ message: "输入的保证金额有误", type: "warning" })
        return
    }
    form_loading.value = true
    proxy.$axios
        .post("supplier/danbao/setDanbao", {
            supplier_id: itemObjs.value.supplier_id,
            danbao_status: setBondstatus.value,
            min_danbao: min_danbao.value,
        })
        .then((res) => {
            form_loading.value = false
            if (res.data.code == 0) {
                dialogSetBond.value = false
                proxy.$message({ message: "设置最低保证金成功！", type: "success" })
                pubParams(getList)
            } else {
                proxy.$message({ message: res.data.msg, type: "error" })
            }
        })
        .catch((err) => {
            form_loading.value = false
        })
}, 500)
const clickSetBond = (row) => {
    min_danbao.value = row.min_danbao
    setBondstatus.value = row.danbao_status
    itemObjs.value = row
    dialogSetBond.value = true
}
const closeSetBond = () => {
    setBondstatus.value = 0
    dialogSetBond.value = false
    min_danbao.value = ""
}

/**
 * 调整保证金
 * @param {Boolean} dialogBond 弹窗状态
 * @param {Array} ruleTwoRef 表单规则
 * @param {Object} ruleTwoForm  表单字段
 * @param {Object} ruleCheck  表单提示
 */
const dialogBond = ref(false)
const ruleTwoRef = ref(null)
const ruleTwoForm = reactive({
    id: "",
    title: "",
    danbao: "",
    price: "",
    reason: "",
    bond_type: "2",
    from_price: "offline",
    voucherImgs: [],
})
const ruleTwoCheck = reactive({
    price: [{ required: true, validator: proxy.$util.validNumOrPoint, trigger: "blur" }],
    reason: [{ required: true, message: "请输入备注内容", trigger: "blur" }],
})
// 确认调整
const submitTwoForm = (formEl) => {
    if (!formEl) return
    formEl.validate((valid, fields) => {
        if (valid) {
            form_loading.value = true
            let data = {
                supplier_id: ruleTwoForm.id,
                type: ruleTwoForm.bond_type,
                from: ruleTwoForm.from_price,
                money: ruleTwoForm.price,
                intro: ruleTwoForm.reason,
                photos: ruleTwoForm.voucherImgs.toString(),
            }
            proxy.$axios
                .post("supplier/danbao/danbaoUpdate", data)
                .then((res) => {
                    form_loading.value = false
                    if (res.data.code == 0) {
                        dialogBond.value = false
                        proxy.$message({ message: "调整保证金成功！", type: "success" })
                        pubParams(getList)
                    } else {
                        proxy.$message({ message: res.data.msg, type: "error" })
                    }
                })
                .catch((err) => {
                    form_loading.value = false
                })
        }
    })
}
const resetTwoForm = (formEl) => {
    if (!formEl) return
    formEl.resetFields()
}
const closeBond = () => {
    resetTwoForm(ruleTwoRef.value)
    dialogBond.value = false
}
// 点击保证金
const adjustBond = (row) => {
    dialogBond.value = true
    setTimeout(() => {
        ruleTwoForm.id = row.supplier_id
        ruleTwoForm.title = row.title
        ruleTwoForm.danbao = row.danbao
    }, 50)
}

/**
 * 添加凭证
 * @property {Boolean} showImg 显示图片库
 * @property {Array} voucherList 预览凭证数组
 * @property {Function} selectImg 选择图片
 */
const showImg = ref(false)
const voucherList = ref([])
const selectImg = (val) => {
    showImg.value = false
    for (let i = 0; i < val.length; i++) {
        ruleTwoForm.voucherImgs.push(val[i].photo)
        voucherList.value.push(proxy.imgUrl + val[i].photo)
    }
}
const delImg = (index) => {
    ruleTwoForm.voucherImgs.splice(index, 1)
    voucherList.value.splice(index, 1)
}
const clickVoucher = () => {
    showImg.value = true
}

// 导出供应商
const clickExport = () => {
    proxy.$axios
        .get("supplier/export", {
            params: {
                supplier_id: supplier_id.value,
                so: supplier_name.value,
                mobile: tel.value,
                tag_id: tag_ids.value,
                dc_title: dc_title.value,
                danbao_status: danbao_status.value,
                supplier_status: supplier_type.value,
                s_time: area_time.value ? area_time.value[0] : "", // 创建时间
                l_time: area_time.value ? area_time.value[1] : "",
            },
            responseType: "blob",
        })
        .then((res) => {
            let contentDisposition = res.headers["content-disposition"]
            let filename = decodeURI(contentDisposition.split("fileName=")[1] || contentDisposition.split("filename=")[1])
            let blob = new Blob([res.data], { type: res.headers["content-type"] })
            const url = window.URL.createObjectURL(blob)
            const link = document.createElement("a")
            link.href = url
            link.download = filename
            document.body.appendChild(link)
            link.click()
            URL.revokeObjectURL(url) // 释放内存
            document.body.removeChild(link)
        })
        .catch((err) => {})
}

// 财务明细
const clickFinance = (row) => {
    router.push({
        path: "/Supplier/SupplierFinance",
        query: {
            sid: row.supplier_id,
        },
    })
}

const clickAdd = () => {
    router.push("/Supplier/SupplierListAdd")
}
const clickEdit = (row) => {
    router.push({
        path: "/Supplier/SupplierListEdit",
        query: {
            eid: row.supplier_id,
            type: 1,
        },
    })
}

// 授权商品
const clickGrant = (row) => {
    router.push({
        path: "/Supplier/SupplierListGrant",
        query: {
            id: row.supplier_id,
        },
    })
}
</script>
<script>
export default {
    name: "SupplierList",
}
</script>

<style lang="less" scoped>
.word-space {
    letter-spacing: 2.5px;
}
</style>
